void build(int type){
 if(!drawFinish){
         if(generateCount == 0){
           randomGenerate();
           
         }else if(generateCount == 1){
           generateMaze();
           
         }else if(generateCount == 2){
     
             djsetGenerate();
           
         }else{
           //methodCount --;
           generateCount = 0;
           drawReset();
             //T = false;
           
         }
     }else {
         if(methodCount == 0){
              BFS();
         }
         else if (methodCount == 1){
              DFS();
              
       }
        else if(methodCount == 2) Astar();
         
        else {
            drawFinish = false;
            //frameCount = 0;
            generateCount ++;
            reset();
                 for (int i = 0; i <= rows * cols; i++) {
        p[i] = i;
    }
    
    for(int i = 0; i < rows; ++ i){
      for(int j = 0; j < cols; ++ j){
          grid[i + j * cols].walls = new boolean[]{true,true,true,true};
      }
    }
        }
     } 
}
